package com.aim.matlab;

import com.aim.analysis.records.*;
import com.aim.azure.AzureConnection;
import com.aim.azure.AzureGameRecordEntity;
import com.aim.util.filters.InCollectionFilter;

import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * User: Avraham Shvartzon
 * Date: 6/18/14
 */
public class MatlabUtil {

    public static  List<Game> getAllGameByDate(int date){
        return getAllGameByDate(Collections.singletonList(date));
    }

    public static List<Game> getAllGameByDate(List experimentDates){
        AzureConnection azureConnection = new AzureConnection();
        try {
            azureConnection.connect();
            for (Object experimentDate : experimentDates) {
                azureConnection.addExperimentDate(experimentDate.toString());
            }

            GameMap gameMap = new GameMap();
            List<Hit> hits = Hit.createHits(gameMap, azureConnection);
            return HitUtil.flattGames(hits);

        } catch (URISyntaxException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (InvalidKeyException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

         return null;
    }

    public static void main(String[] args) {
        Arrays.asList();
        List<Game> allGameByDate = getAllGameByDate(Arrays.asList(20140616,20140619));
        System.out.println(allGameByDate.size());
    }
}
